﻿package
{
	import org.flixel.*;
	import org.flixel.plugin.photonstorm.FlxCollision;
	import org.flixel.plugin.photonstorm.FlxBar;
	import org.flixel.plugin.photonstorm.FlxWeapon;
	
	public class Level1 extends GeneralPlayState
	{	
		[Embed(source="data/tiles1.png")] private var ImgTiles:Class;
		[Embed(source ="data/map1.csv", mimeType = "application/octet-stream")] private var MapData:Class;
		[Embed(source="data/music.mp3")] private var Music:Class;

			public var _level:FlxTilemapExt;
			public var enemy1:Enemy1;
			public var enemy2:Enemy2;
			public var enemy3:Enemy3;
			
			public var music:FlxSound;
				

	
		override public function create():void
		{			
			super.create()
		
			_level = new FlxTilemapExt();
			_level.loadMap(new MapData,ImgTiles);
			add(_level);
			FlxG.camera.setBounds(0, 0, _level.width, _level.height, true);
			
			enemy1 = new Enemy1(190,110);
			enemy2 = new Enemy2(360,165);
			enemy3 = new Enemy3(510,105);
			
			music = FlxG.play(Music,0.5,true);

			
		}

		
		
		override public function destroy():void
		{
			super.destroy();
		}
		
		override public function update():void
		{
			//generalmessage.text = "faceRight " + (enemy.facing == FlxObject.RIGHT).toString() + " Wall " + enemy.isTouching(FlxObject.WALL).toString() + " Floor " + enemy.isTouching(FlxObject.FLOOR).toString() + " tile " + _level.getTile(player.x/15,(player.y+player.height)/15).toString() + "x " + player.x/15 +"y "+ (((player.y+player.height) /15)).toString();
			super.update();
			//btnleftPressed = false;
		}
	}
}
